/*
 * LDIR
 *
 * LDIR, a GPS cartography application built for Let's Do It Romania eco
 * campaign.
 * Copyright (C) 2010 Genera Software <office@generasoftware.com>
 *
 * http://generasoftware.com/
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation; either version 2 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 * Place, Suite 330, Boston, MA 02111-1307 USA
 */
#ifndef LDIRWSUTILITIES_H
#define LDIRWSUTILITIES_H
#include <e32base.h>
#include <hash.h>
#include <imcvcodc.h>
#include <e32math.h>
_LIT8(KConsumerKey, "ldir-symbiankey");
_LIT8(KConsumerSecret, "1137J4s542UCH09IQB9g1Y3DH4Mik2rCW89no4robDzQQ7m0RpAAAYk9PDgQi29j&");
_LIT8(KSignatureBaseStringFormat, "%S&%S&oauth_consumer_key=%S&oauth_signature_method=%S&oauth_timestamp=%S&oauth_nonce=%S");
_LIT8(KOAuthStringFormat, "OAuth realm=\"%S\",oauth_consumer_key=\"%S\",oauth_signature_method=\"%S\",oauth_signature=\"%S\",oauth_timestamp=\"%S\",oauth_nonce=\"%S\"");
_LIT8(KHMAC_SHA1, "HMAC-SHA1");
_LIT8(KMD5, "MD5");
_LIT8(KHttp, "http");
_LIT8(KHttps, "https");
//_LIT8(KWSVersion, "/v1");
_LIT8(KJsonContentType, "application/json");
_LIT8(KHttpGET, "GET");
_LIT8(KHttpPOST, "POST");
_LIT8(KHttpDELETE, "DELETE");
_LIT8(KLdirHost, "ldir-mobile.gtstelecom.ro/LetsDoItWS");

const TUint KOAuthNonceSize = 16;
const TUint KTimestampLen = 16;

HBufC8* GenerateSignatureStringLC( const TDesC8& aHttpMethod,
	const TDesC8& aResourceUri, const TDesC8& aConsumerKey,
	const TDesC8& aConsumerSecret, const TDesC8& aSignatureMethod,
	const TDesC8& aOAuthTimestamp, const TDesC8& aOAuthNonce );
HBufC8* GenerateOAuthLC( const TDesC8& aRealm, const TDesC8& aConsumerKey,
	const TDesC8& aSignatureMethod, const TDesC8& aSignature,
	const TDesC8& aTimestamp, const TDesC8& aNonce );
TBuf8<KTimestampLen> GetTimestamp();
TBuf8<KTimestampLen> GetTimestamp( TTime& aTime );
// Base64 encoding increases size by 33% please take this in consideration
void DoBase64Encoding( const TDesC8& aSourceData, TDes8& aEncodedData );
void DoBase64Decoding( const TDesC8& aSourceData, TDes8& aDecodedData );

#endif // LDIRWSUTILITIES_H
// End of File
